/*
 *   AS IS License
 * ==Naive Coders==
 */
package com.naivecoders.refex.functions;

import static com.naivecoders.refex.functions.FCode.*;
import com.naivecoders.refex.FunctionFactory;
import com.naivecoders.refex.functions.solids.NamedSolid;
/**
 *
 * @author gbu.000
 */
@NamedSolid(C)
public class IfFunction extends AbstractFunction {

    public IfFunction(FunctionFactory origin) {
        super(origin);
    }

    @Override
    public AbstractFunction evaluate(ListFunction x) throws InvocationException {
        if (arg(x,0)== getOrigin().trueFunction()) {
            return arg(x, 1);
        }
        return arg(x,2);
    }
}
